/**
 * @ClassName LC83
 * @Author ykx
 * @Date 2024/3/23 11:06
 * @Version 1.0
 */
public class LC83 {
    public static void main(String[] args) {
        LC83 lc83 = new LC83();
        int[] nums = new int[]{1, 1, 2, 3, 3};
        ListNode listNode = ListNode.setData(nums);
        System.out.println(lc83.deleteDuplicates(listNode));
    }

    public ListNode deleteDuplicates(ListNode head) {
        ListNode cur = head;
        while (cur != null && cur.next != null) {
            if (cur.val == cur.next.val) {
                cur.next = cur.next.next;
            } else {
                cur = cur.next;
            }
        }
        return head.next;
    }
}
